0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 0 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 0 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 139 ms)
↳10 BOUNDS(1, n^1)
a__f(X, g(X), Y) → a__f(Y, Y, Y)
a__g(b) → c
a__b → c
mark(f(X1, X2, X3)) → a__f(X1, X2, X3)
mark(g(X)) → a__g(mark(X))
mark(b) → a__b
mark(c) → c
a__f(X1, X2, X3) → f(X1, X2, X3)
a__g(X) → g(X)
a__b → b
a__f(X, g(X), Y) → a__f(Y, Y, Y) [1]
a__g(b) → c [1]
a__b → c [1]
mark(f(X1, X2, X3)) → a__f(X1, X2, X3) [1]
mark(g(X)) → a__g(mark(X)) [1]
mark(b) → a__b [1]
mark(c) → c [1]
a__f(X1, X2, X3) → f(X1, X2, X3) [1]
a__g(X) → g(X) [1]
a__b → b [1]
a__f(X, g(X), Y) → a__f(Y, Y, Y) [1]
a__g(b) → c [1]
a__b → c [1]
mark(f(X1, X2, X3)) → a__f(X1, X2, X3) [1]
mark(g(X)) → a__g(mark(X)) [1]
mark(b) → a__b [1]
mark(c) → c [1]
a__f(X1, X2, X3) → f(X1, X2, X3) [1]
a__g(X) → g(X) [1]
a__b → b [1]
a__f :: g:b:c:f → g:b:c:f → g:b:c:f → g:b:c:f g :: g:b:c:f → g:b:c:f a__g :: g:b:c:f → g:b:c:f b :: g:b:c:f c :: g:b:c:f a__b :: g:b:c:f mark :: g:b:c:f → g:b:c:f f :: g:b:c:f → g:b:c:f → g:b:c:f → g:b:c:f |
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
b => 0
c => 1
a__b -{ 1 }→ 1 :|:
a__b -{ 1 }→ 0 :|:
a__f(z, z', z'') -{ 1 }→ a__f(Y, Y, Y) :|: Y >= 0, z'' = Y, z' = 1 + X, X >= 0, z = X
a__f(z, z', z'') -{ 1 }→ 1 + X1 + X2 + X3 :|: X1 >= 0, X3 >= 0, X2 >= 0, z = X1, z' = X2, z'' = X3
a__g(z) -{ 1 }→ 1 :|: z = 0
a__g(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
mark(z) -{ 1 }→ a__g(mark(X)) :|: z = 1 + X, X >= 0
mark(z) -{ 1 }→ a__f(X1, X2, X3) :|: X1 >= 0, X3 >= 0, z = 1 + X1 + X2 + X3, X2 >= 0
mark(z) -{ 1 }→ a__b :|: z = 0
mark(z) -{ 1 }→ 1 :|: z = 1
eq(start(V, V1, V2),0,[fun(V, V1, V2, Out)],[V >= 0,V1 >= 0,V2 >= 0]). eq(start(V, V1, V2),0,[fun1(V, Out)],[V >= 0]). eq(start(V, V1, V2),0,[fun2(Out)],[]). eq(start(V, V1, V2),0,[mark(V, Out)],[V >= 0]). eq(fun(V, V1, V2, Out),1,[fun(Y1, Y1, Y1, Ret)],[Out = Ret,Y1 >= 0,V2 = Y1,V1 = 1 + X4,X4 >= 0,V = X4]). eq(fun1(V, Out),1,[],[Out = 1,V = 0]). eq(fun2(Out),1,[],[Out = 1]). eq(mark(V, Out),1,[fun(X11, X21, X31, Ret1)],[Out = Ret1,X11 >= 0,X31 >= 0,V = 1 + X11 + X21 + X31,X21 >= 0]). eq(mark(V, Out),1,[mark(X5, Ret0),fun1(Ret0, Ret2)],[Out = Ret2,V = 1 + X5,X5 >= 0]). eq(mark(V, Out),1,[fun2(Ret3)],[Out = Ret3,V = 0]). eq(mark(V, Out),1,[],[Out = 1,V = 1]). eq(fun(V, V1, V2, Out),1,[],[Out = 1 + X12 + X22 + X32,X12 >= 0,X32 >= 0,X22 >= 0,V = X12,V1 = X22,V2 = X32]). eq(fun1(V, Out),1,[],[Out = 1 + X6,X6 >= 0,V = X6]). eq(fun2(Out),1,[],[Out = 0]). input_output_vars(fun(V,V1,V2,Out),[V,V1,V2],[Out]). input_output_vars(fun1(V,Out),[V],[Out]). input_output_vars(fun2(Out),[],[Out]). input_output_vars(mark(V,Out),[V],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. recursive : [fun/4]
1. non_recursive : [fun1/2]
2. non_recursive : [fun2/1]
3. recursive [non_tail] : [mark/2]
4. non_recursive : [start/3]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into fun/4
1. SCC is partially evaluated into fun1/2
2. SCC is partially evaluated into fun2/1
3. SCC is partially evaluated into mark/2
4. SCC is partially evaluated into start/3
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations fun/4
* CE 7 is refined into CE [15]
* CE 6 is refined into CE [16]
### Cost equations --> "Loop" of fun/4
* CEs [16] --> Loop 10
* CEs [15] --> Loop 11
### Ranking functions of CR fun(V,V1,V2,Out)
#### Partial ranking functions of CR fun(V,V1,V2,Out)
### Specialization of cost equations fun1/2
* CE 8 is refined into CE [17]
### Cost equations --> "Loop" of fun1/2
* CEs [17] --> Loop 12
### Ranking functions of CR fun1(V,Out)
#### Partial ranking functions of CR fun1(V,Out)
### Specialization of cost equations fun2/1
* CE 9 is refined into CE [18]
* CE 10 is refined into CE [19]
### Cost equations --> "Loop" of fun2/1
* CEs [18] --> Loop 13
* CEs [19] --> Loop 14
### Ranking functions of CR fun2(Out)
#### Partial ranking functions of CR fun2(Out)
### Specialization of cost equations mark/2
* CE 11 is refined into CE [20,21]
* CE 14 is refined into CE [22]
* CE 13 is refined into CE [23,24]
* CE 12 is refined into CE [25]
### Cost equations --> "Loop" of mark/2
* CEs [25] --> Loop 15
* CEs [20] --> Loop 16
* CEs [21,22] --> Loop 17
* CEs [24] --> Loop 18
* CEs [23] --> Loop 19
### Ranking functions of CR mark(V,Out)
* RF of phase [15]: [V]
#### Partial ranking functions of CR mark(V,Out)
* Partial RF of phase [15]:
- RF of loop [15:1]:
V
### Specialization of cost equations start/3
* CE 2 is refined into CE [26,27]
* CE 3 is refined into CE [28]
* CE 4 is refined into CE [29,30]
* CE 5 is refined into CE [31,32,33,34,35]
### Cost equations --> "Loop" of start/3
* CEs [26,27,28,29,30,31,32,33,34,35] --> Loop 20
### Ranking functions of CR start(V,V1,V2)
#### Partial ranking functions of CR start(V,V1,V2)
Computing Bounds
=====================================
#### Cost of chains of fun(V,V1,V2,Out):
* Chain [11]: 1
with precondition: [V+V1+V2+1=Out,V>=0,V1>=0,V2>=0]
* Chain [10,11]: 2
with precondition: [V1=V+1,3*V2+1=Out,V1>=1,V2>=0]
#### Cost of chains of fun1(V,Out):
* Chain [12]: 1
with precondition: [V+1=Out,V>=0]
#### Cost of chains of fun2(Out):
* Chain [14]: 1
with precondition: [Out=0]
* Chain [13]: 1
with precondition: [Out=1]
#### Cost of chains of mark(V,Out):
* Chain [[15],19]: 2*it(15)+2
Such that:it(15) =< Out
with precondition: [V=Out,V>=1]
* Chain [[15],18]: 2*it(15)+2
Such that:it(15) =< Out
with precondition: [V+1=Out,V>=1]
* Chain [[15],17]: 2*it(15)+2
Such that:it(15) =< Out
with precondition: [V=Out,V>=2]
* Chain [[15],16]: 2*it(15)+3
Such that:it(15) =< 3/2*V-Out/2
with precondition: [Out>=2,3*V>=Out+7]
* Chain [19]: 2
with precondition: [V=0,Out=0]
* Chain [18]: 2
with precondition: [V=0,Out=1]
* Chain [17]: 2
with precondition: [V=Out,V>=1]
* Chain [16]: 3
with precondition: [Out>=1,3*V>=Out+5]
#### Cost of chains of start(V,V1,V2):
* Chain [20]: 2*s(4)+4*s(6)+2*s(7)+3
Such that:s(5) =< V
s(4) =< V+1
s(7) =< 3/2*V
s(6) =< s(5)
with precondition: []
Closed-form bounds of start(V,V1,V2):
-------------------------------------
* Chain [20] with precondition: []
- Upper bound: nat(V)*4+3+nat(3/2*V)*2+nat(V+1)*2
- Complexity: n
### Maximum cost of start(V,V1,V2): nat(V)*4+3+nat(3/2*V)*2+nat(V+1)*2
Asymptotic class: n
* Total analysis performed in 122 ms.